import { Wallpaper } from '@libs/db/models/wallpaper.model';
import { Controller, Get } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Crud } from 'nestjs-mongoose-crud';
import { InjectModel } from 'nestjs-typegoose';


@Crud({
    model: Wallpaper
})
@Controller('wallpapers')
@ApiTags('壁纸')
export class WallpapersController {

    constructor(@InjectModel(Wallpaper) private readonly model){}

    @Get('option')
    option() {
        return {
            title: '壁纸管理',
            border: true,
            searchMenuSpan: 8,
            column: [
                {
                    prop: 'name',
                    label: '名称',
                    search: true
                },
                {
                    prop: 'picture',
                    label: '图片',
                    span: 24,
                    type: 'upload',
                    listType: 'picture-img',
                    tip: '只能上传jpg/png图片，且不超过500kb',
                    action: 'http://localhost:3009/upload'
                }
            ]
        }
    }
}
